package com.bluefox.uac.repository;

import com.bluefox.uac.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.Date;

/**
 * UserRepository
 * @author SunFeng
 */
public interface UserRepository extends CrudRepository<User, Long>, JpaRepository<User, Long> {

    /** 根据用户名查询用户信息
     * @param username
     * @return User
     */
    User findByUsername(String username);

    @Modifying
    @Query(value = "update user set password = ?2  where username = ?1",nativeQuery = true)
    void updatePass(String username, String pass);

}
